package ACwing.P4Math.Prime;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Date : 2023-03-16
 * @Description:866. 试除法判定质数
 * d/n能整除，则n/d也能整除n，是成对出现，只需要判断到d<=n/d,d<=sqrt(n)
 */
public class Divisor {
    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(bufferedReader.readLine());
        while (n--!=0){
          int x= Integer.parseInt(bufferedReader.readLine());
            System.out.println(is_prime(x)?"Yes":"No");
        }

    }
    static boolean is_prime(int n){
        if(n<2) return false;
        for (int i = 2; i <=n/i; i++) //sqrt慢,i*i<n容易溢出
            if(n%i==0) return false;
            return true;
    }
}
